(function(app){
	
	app.action(['/certification'], 'certification/certification.html', ['$scope', '$route', '_API', '$location', '$timeout', '$rootScope',
		function($scope, $route, _API, $location, $timeout, $rootScope) {

			var upload = $SDC.apiDomain + "/myAccount/certification/realName.json";
			var shade = document.getElementById('shade'); //上传文件时页面形成遮罩
			$scope.submit = function() {
				var fileObj = document.getElementById("exampleInputFile").files[0]; // 获取文件对象
				// var fileSize = fileObj.fileSize;
				// var size = fileSize / 1024;    
				// if(size>500){  
				//    alert("附件不能大于500k");
				//    return;
				// }
				var form = new FormData();
				form.append("img", fileObj); // 文件对象    
				form.append("appId","6103_web");
				form.append("sig","6103_web");
				shade.style.display = 'block';
				$.ajax({
					"url": upload,
					"dataType": "JSON",
					"data": form,
					"type": "POST",
					"cache": false,
					"timeout": 30000,
					"xhrFields": {
						"withCredentials": true
					},
					"crossDomain": true,
					processData: false,
					contentType: false,
					success: function(json) {
						alert(json.result.info);
						document.fileForm.reset();
						shade.style.display = 'none';
					},
					error: function(json, status) {
						if(status == 'timeout') { // 超时,status还有success,error等值的情况
							error({
								code: -1001,
								msg: 'Ajax timeout'
							});
						} else {
							error({
								code: -1000,
								msg: 'Ajax error'
							});
						}
						document.fileForm.reset();
						shade.style.display = 'none';
					}
				});
			}
						
		}
	]);
	
})($SDC.app);